library ieee;
use ieee.std_logic_1164.all;

use ieee.numeric_std.all;
use work.Achtung_const.all;


entity collision_detector is 
	port(	
		start 	: in std_logic;
		
		row 		:in unsigned(9 downto 0);
		column 		:in unsigned(9 downto 0);
		
		row_out 		:out unsigned(9 downto 0);
		column_out		:out unsigned(9 downto 0);
		
		command : out std_logic_vector(1 downto 0);
		
		memory_done : in std_logic;

		collision : out std_logic;
				
		pixel 	: in RAM_Data;
		
		complete :out std_logic
	);
end entity;	
	
	
	architecture arch of collision_detector is
	
	begin
	row_out <= row;
	column_out <= column;
	complete <= memory_done;
	process(start,pixel,row, column)
	begin
	
		if(start = '1') then
			command <= RAM_READ_COMM;
		else 
			command <= "00";
		end if;
		
		if(pixel = PLAYER1 or pixel = PLAYER2 or 
			column = "0000000000" or row = "0000000000" or
			column = "1001111111" or row = "111011111") then
			collision <= '1';
		else
			collision <= '0';
		end if;
	
	end process;
	
	
	end arch;